package com.etone.H2.client;

import java.io.*;
import java.net.*;

import com.etone.H2.engine.DataServer;

public class DataSend {
	Socket socket;
	BufferedReader in;
	PrintWriter out;

	public DataSend() {
		try {
			
			socket = new Socket(DataServer.Server_IP, DataServer.Server_Port);
			in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
			
//			BufferedReader br = new BufferedReader( new FileReader(new File("F:/1M.csv")));
			BufferedReader br = new BufferedReader( new FileReader(new File("F:/10K.csv")));
			
			out = new PrintWriter(socket.getOutputStream(), false);
//			BufferedReader line = new BufferedReader(new InputStreamReader(System.in));

			int k = 0 ;
			while(br.ready()){
				out.println(br.readLine());
				if(k++==500){
					try {
						Thread.sleep(5000);
					} catch (InterruptedException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				}
			}
			
			out.flush();
			try {
				Thread.sleep(15000);
				br.close();
				out.close();
				
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		} catch (IOException e) {
		}
	}

	public static void main(String[] args) {
		new DataSend();
	}
}
